$(function(){
	var index = 0;
	var timer = null;
	
	var length = $('.post2_cont_tab li').length;
	var disHeight = $('.post2_cont_txt_text_all p').height();
	var proHeight = $('.post2_cont_pic_text_all p').height();
	$('.post2_cont_tab li').eq(0).addClass('on');
	//轮播
	timer = setInterval(move,2000);
	function move(){
		index++;
		if(index>=length){
			index=0;
		}
		$('.post2_cont_tab li').eq(index).addClass('on').siblings().removeClass('on');
		$('.post2_cont_txt_text_all').stop(true).animate({marginTop: -index * disHeight + "px"},800);
		$('.post2_cont_pic_text_all').stop(true).animate({marginTop: -index * proHeight+ "px"},800);
	}
	//鼠标停留
	$('.post2_cont').hover(function(){
		clearInterval(timer);
	},function(){
		timer = setInterval(move,2000);
	});			
	//li控制
	$('.post2_cont_tab li').mousemove(function(){
		$(this).addClass('on').siblings().removeClass('on');
		var liIndex = $(this).index();
		index = liIndex-1;
		move();
	})
	//点击控制
	$('.post2_cont_btn img')[0].onclick=function(){
		index-=2;
		if(index<-1){
			index=3;
		}
		move()
	}
	$('.post2_cont_btn img')[1].onclick=function(){
		move()
	}
	
	
	//li动画
	var state = false;
	$('.post3_cont_add').click(function(){
		if(!state){
			$('.post3_cont_cont').animate({height:'830px'},1000);
			$('.post3_cont_cont ul').animate({height:'820px'},1000);
			$(this).html('-');
			return state = true;
		}else{
			$('.post3_cont_cont').animate({height:'410px'},1000);
			$('.post3_cont_cont ul').animate({height:'337px'},1000);
			$(this).html('+');
			return state = false;
		}
	})
	
	//scrollTop动画
	$(function(){
		var windowH = $(window).height(),
			scrollTop = $(window).scrollTop();
		$(window).scroll(function(){
			scrollTop = $(window).scrollTop();
			if(($(".post3").offset().top - scrollTop) < (windowH - $(".post3").height() / 2)) {
					$('.post3').css({
						animation: "world_mov2 1s"
					});
				}
		})
	})
	
	
})
